import request from '@/utils/request'

export function getRoles(params) {
  return request({
    url: '/roles',
    method: 'get',
    params
  })
}

export function addRole(data) {
  return request({
    url: '/roles',
    method: 'post',
    data
  })
}

export function getRoleById(id) {
  return request({
    url: `/roles/${id}`,
    method: 'get'
  })
}

export function editRole(data) {
  return request({
    url: `/roles/${data.id}`,
    method: 'put',
    data
  })
}

export function delRole(id) {
  return request({
    url: `/roles/${id}`,
    method: 'delete'
  })
}

export function getCount() {
  return request({
    url: '/roles/count'
  })
}
